#双循环，一一比较，内层循环从外层循环的元素位置开始
def maopaoSort(list):
    if len(list)<=1:
        return list
    for i in range(len(list)):
        for j in range(i,len(list)):
            if list[i]>list[j]:
                list[i],list[j] = list[j],list[i]
    return list
# print(maopaoSort([1,5,3,2,7,6,3,9,7,8,6]))

#经典冒泡排序
def bubbleSort(list):
    if len(list)<=1:
        return list
    for i in range(len(list)-1):
        for j in range(len(list)-1-i):
            if list[j]>list[j+1]:
                list[j],list[j+1]=list[j+1],list[j]
    return list
print(bubbleSort([1,5,3,2,7,6,3,9,7,8,6]))